#include <linux/sched.h>
#include <linux/sched/task.h>
#include <linux/string.h>
#include <linux/init.h>
#include <linux/pid.h>
#include <linux/stdlib.h>
#include <linux/refcount.h>

struct task_struct *alloc_task_struct_node(int node)
{
    return kzalloc(sizeof(struct task_struct), GFP_KERNEL);
}

int alloc_thread_stack_node(struct task_struct *tsk, int node)
{
    tsk->stack = kzalloc(THREAD_SIZE, GFP_KERNEL);
    if (!tsk->stack)
        return -ENOMEM;

    return 0;
}

void release_task_struct(struct task_struct *tsk)
{
    kfree(tsk);
}

void release_task_stack(struct task_struct *tsk)
{
    kfree(tsk->stack);
    tsk->stack = NULL;
}
